var e = require("../../../@babel/runtime/helpers/defineProperty"),
  t = require("../../../@babel/runtime/helpers/objectWithoutProperties"),
  a = ["url"],
  r = getApp();

Component({
  properties: {
    datasource: {
      type: Array
    },
    orderType: {
      type: String
    },
    detailUrl: {
      type: String
    },
    status: {
      type: Number
    },
    consolidated: {
      type: Boolean,
      value: !1
    },
    custom_receipt_confirmation_html: {
      type: String,
      value: ""
    },
    member_type: {
      type: null,
      value: ""
    },
    isOrder: {
      type: Boolean,
      value: !1
    }
  },
  data: {
    language: "",
    regional: "请选择快递公司",
    dataItem: {
      value: 140,
      api: 1
    },
    dateshow_1: !1,
    columns: [],
    checkList: [],
    options: [],
    dialogVisible: !1,
    expressName: "",
    numberName: "",
    addresseeInfo: {},
    showQrcode: !1,
    qrcode_url: "",
    sendGoogsFail: {
      show: !1,
      msg: ""
    },
    showID: "",
    jurisdiction_set: 0,
    showBarter: !1,
    showBarter_value: null,
    filterExpressCompanys: [],
    inputExpressCompanyName: "",
    orderPayId: null,
    blindBoxInfo: {
      show: !1,
      goods: []
    },
    refundShow: !1,
    refundText: "",
    custom_receipt_confirmation_show: !1,
    custom_receipt_confirmation_btn: {},
    custom_receipt_confirmation_item: {},
    inventoryApplyPopup: !1,
    inventoryApplyList: [],
    inventoryApplyRadio: null,
    showKefu: !1,
    overlayShow: !1,
    drawShow: !1,
    drawType: 1,
    newBlindBoxData: {}
  },
  lifetimes: {
    attached: function () {
      var e = wx.getStorageSync("langIndex"),
        t = wx.getStorageSync("yz_basic_info");
      this.setData({
        language: e.en,
        vip_show: !!t.globalParameter.vip_show && t.globalParameter.vip_show
      });
    },
    moved: function () {},
    detached: function () {}
  },
  pageLifetimes: {
    show: function () {},
    hide: function () {},
    resize: function () {}
  },
  methods: {
    toUrl: function (e) {
      var t = e.currentTarget.dataset || {};
      this.wxRouterLink(t);
    },
    wxRouterLink: function (e) {
      var r = "",
        o = e.url,
        i = t(e, a);
      Object.keys(i).forEach(function (e) {
        "" !== i[e] && (r += e + "=" + i[e] + "&");
      }), "" !== o && wx.navigateTo({
        url: o + "?" + r.slice(0, -1)
      });
    },
    filterExpressCompany: function (e) {
      var t = e.detail,
        a = this.data.columns;
      this.setData({
        filterExpressCompanys: a.filter(function (e) {
          return -1 !== e.indexOf(t);
        }),
        inputExpressCompanyName: t
      });
    },
    toStore: function (e) {
      var t = e.currentTarget.dataset.order;
      92 == t.plugin_id ? wx.navigateTo({
        url: "/packageA/member/supplier/SupplierShop/SupplierShop?id=" + t.id + "&fromOrder=1"
      }) : 31 == t.plugin_id || 32 == t.plugin_id ? wx.navigateTo({
        url: "/packageC/o2o/o2oStore/o2oStore?store_id=" + t.id + "&fromOrder=1"
      }) : 54 == t.plugin_id && t.has_one_team_member.store_id ? wx.navigateTo({
        url: "/packageC/o2o/o2oStore/o2oStore?store_id=" + t.has_one_team_member.store_id + "&fromHome=1"
      }) : 0 == t.plugin_id && wx.reLaunch({
        url: "/packageG/index/index"
      });
    },
    showMore: function (e) {
      var t = e.currentTarget.dataset.order.order_sn;
      this.data.showID == t ? this.setData({
        showID: ""
      }) : this.setData({
        showID: t
      });
    },
    getTemplate: function (e, t) {
      var a = r.getNetAddresss("member.member.getMiniTemplateCorrespond"),
        o = this;
      r._getNetWork({
        url: a,
        data: {
          small_type: 2
        },
        success: function (a) {
          var r = a.data;
          if (1 == r.result) {
            for (var i = [], s = 0; s < r.data.length; s++) i.push(r.data[s].template_id);
            o.setData({
              TemplateArray: i
            }), wx.requestSubscribeMessage({
              tmplIds: o.data.TemplateArray,
              success: function (a) {
                o._toRefund(e, t);
              },
              fail: function () {
                o._toRefund(e, t);
              }
            });
          } else wx.showToast({
            title: r.msg,
            icon: "none",
            duration: 1500
          });
        },
        fail: function (e) {
          console.log(e);
        }
      });
    },
    multiplePayChange: function (e) {
      this.setData({
        checkList: e.detail
      }), this.triggerEvent("MultiplePayNotification", this.data.checkList);
    },
    goOrderdetail: function (e) {
      var t = this.data.orderType,
        a = e.currentTarget.dataset.orderid;
      2 != this.data.member_type && 4 != this.data.member_type ? wx.navigateTo({
        url: "/packageA/member/orderdetail/orderdetail?order_id=" + a + "&orderType=" + t
      }) : wx.navigateTo({
        url: "/packageA/member/orderdetail/orderdetail?order_id=" + a + "&orderType=" + t + "&debt_shop_member_type=" + this.data.member_type
      });
    },
    operation: function (e) {
      var t = e.currentTarget.dataset.item,
        a = e.currentTarget.dataset.order,
        r = e.currentTarget.dataset.orderidx;
      console.log(e, 'eeeeeee')
      if (this.setData({
          orderPayId: a.id
        }), t.api || 41 == t.value)
        if (console.log(t), 8 == t.value || "snatch_regiment_express" == t.value) this._checklogistics(a, t);
        else if (12 == t.value) this._deleteOrder(a, t, r);
      else if (51 == t.value) "71" == a.plugin_id && wx.navigateTo({
        url: "/packageH/cpsPwd/cpsPwd?id=" + a.id
      });
      else if (10 == t.value) this._comment(a, t);
      else if (1 == t.value || "snatch_regiment_pay" == t.value) this._toPay(a, t);
      else if (13 == t.value || "snatch_regiment_refund" == t.value || "54" == t.value) {
        this.getTemplate(a, t);
      } else if (9 == t.value) this._cancleOrder(a, t, r);
      else if (5 == t.value) this._confirmOrder(a, t);
      else if (18 == t.value) this._toRefundDetail(a, t);
      else if ("cashierPay" == t.value) this._cashPayOrder(a, t);
      else if ("verification_code" == t.value) this._verification(a, t);
      else if (20 == t.value) this._verificationCash(a, t);
      else if (21 == t.value) wx.navigateTo({
        url: "/packageD/member/myOrder/order_record/order_record?order_id=" + item.id
      });
      else if (22 == t.value) this._payMoney(a, t);
      else if (101 == t.value) {
        var o = "/packageE/pickUpCard/pickUpCardReimburse/pickUpCardReimburse?orderid=" + a.id;
        "picking-card-one" != this.data.orderType && 95 != a.plugin_id || (o += "&plugin=one"),
          wx.navigateTo({
            url: o
          });
      } else "coupon" == t.value ? (console.log(a.id), wx.navigateTo({
        url: "/packageD/coupon_share/coupon_share?orderid=" + a.id
      })) : 23 == t.value || 60 == t.value ? (3 == a.dispatch_type_id ? this.sendGoogs() : (this._getCompany(),
        this.setData({
          dialogVisible: !0
        })), this.triggerEvent("stoprefresh", !0), this.setData({
        expressName: "",
        numberName: ""
      })) : 24 == t.value || 61 == t.value ? this._deliverGoodsCancel(a, t) : 25 == t.value ? this._collectGoods(a, t) : 26 == t.value ? this._closeOrderPay(a, t) : 30 == t.value ? this._closeOrderPay(a, t, "确定退款关闭订单?") : 27 == t.value ? this._evaluate(a, t) : 28 == t.value ? this._truckList(t, a) : 41 == t.value ? this.getKefu(a.has_many_order_goods) : 50 == t.value ? this._checkInvoice(t, a) : 11 == t.value ? this.confirmHotelOrder(t.api, a.id) : "lease_toy_refund" == t.value || "package_deliver_clerk" == t.value ? (console.log("申请归还"),
        this.getRuruen(t, a)) : "lease_toy_apply_adopt" == t.value ? (console.log("填写归还"),
        wx.navigateTo({
          url: "/packageB/member/OrderReturn/OrderReturn?id=" + a.id
        })) : "lease_toy_return_info" == t.value ? (console.log("归还详情"), wx.navigateTo({
        url: "/packageA/others/order_ruturn_info/order_ruturn_info?id=" + a.id
      })) : "package_deliver" == t.value || "package_delivery_confirm_code" == t.value || "store_package_deliver" == t.value || "reserve_simple" == t.value ? (console.log("自提点核销"),
        console.log(t.api), this.getQrImg(t, a)) : "expediting_delivery" == t.value ? this.publicMessage(t, a, "提醒商家发货") : "snatch_regiment_barter" == t.value ? this.setData({
        showBarter: !0,
        showBarter_value: a.barter
      }) : 53 == t.value ? this.getBlindBoxGoods(a.id) : 56 == t.value ? wx.navigateTo({
        url: "/packageH/project_verification/MyProject/MyProject"
      }) : "close_reason" == t.value ? this.setData({
        refundShow: !0,
        refundText: a.close_reason
      }) : 140 == t.value ? wx.navigateTo({
        url: "/packageI/brand_resources/cardVoucherInfo/cardVoucherInfo?id=" + a.id
      }) : "city_delivery_detail" == t.value ? wx.navigateTo({
        url: "/packageA/member/order/orderLogisticsDetails/orderLogisticsDetails?id=" + a.id
      }) : "inventory_apply" == t.value ? this.getWarehouseList_CH() : "new_blind_box_unpacking" == t.value ? wx.navigateTo({
        url: "/packageF/new_blind_box/blindBox/index?order_id=" + a.id
      }) : "new_blind_box_goods" == t.value ? this.setData({
        overlayShow: !0,
        newBlindBoxData: {
          api: t.api,
          order_id: a.id
        }
      }) : "new_blind_box_exchange_order" == t.value ? this.setData({
        drawShow: !0,
        drawType: 2,
        newBlindBoxData: {
          api: t.api,
          order_id: a.id
        }
      }) : "new_blind_box_sub_order" == t.value ? this.setData({
        drawShow: !0,
        drawType: 1,
        newBlindBoxData: {
          api: t.api,
          order_id: a.id
        }
      }) : this.publicMessage(t, a, t.name);
      else "expediting_delivery" == t.value ? wx.showToast({
        icon: "none",
        title: "已提醒过商家",
        duration: 1e3
      }) : wx.showToast({
        icon: "none",
        title: "缺失必要参数",
        duration: 1e3
      });
    },
    getBlindBoxGoods: function (t) {
      var a = this,
        o = r.getNetAddresss("plugin.blind-box.api.index.blind-box-goods");
      o += "&order_id=" + this.data.orderPayId, r._getNetWork({
        url: o,
        success: function (t) {
          var r, o = t.data;
          1 == o.result ? a.setData((e(r = {}, "blindBoxInfo.show", !0), e(r, "blindBoxInfo.goods", o.data.order),
            r)) : wx.showToast({
            icon: "none",
            title: o.msg,
            duration: 1200
          });
        },
        fail: function (e) {
          console.log(e);
        }
      });
    },
    blindBoxInfoTap: function () {
      this.setData(e({}, "blindBoxInfo.show", !1));
    },
    goOrderList: function (e) {
      console.log(e);
      var t = e.currentTarget.dataset.item.id,
        a = this.data.orderType;
      wx.navigateTo({
        url: "/packageA/member/orderdetail/orderdetail?order_id=" + t + "&orderType=" + a
      });
    },
    confirmBarter: function () {
      var e = r.getNetAddresss("plugin.snatch-regiment.api.order.barter");
      e += "&order_id=" + this.data.orderPayId, r._getNetWork({
        url: e,
        success: function (e) {
          var t = e.data;
          1 == t.result ? (wx.showToast({
            title: "易货兑换成功",
            icon: "success",
            duration: 1500,
            success: function () {}
          }), that.getdata()) : wx.showToast({
            icon: "none",
            title: t.msg,
            duration: 1200
          });
        },
        fail: function (e) {
          console.log(e);
        }
      });
    },
    cancelBarter: function () {
      this.setData({
        showBarter: !1,
        showBarter_value: null
      });
    },
    getQrImg: function (e, t) {
      var a = this,
        o = r.getNetAddresss(e.api);
      "package_deliver" == e.value || "store_package_deliver" == e.value || "package_delivery_confirm_code" == e.value ? o += "&order_id=" + t.id : "reserve_simple" == e.value ? o += "&id=" + t.id : o += "&order_pay_id=" + t.id,
        r._getNetWork({
          url: o,
          success: function (e) {
            var t = e.data;
            1 == t.result ? a.setData({
              showQrcode: !0,
              qrcode_url: t.data.qr_code_url
            }) : wx.showToast({
              icon: "none",
              title: t.msg,
              duration: 1e3
            });
          },
          fail: function (e) {
            console.log(e);
          }
        });
    },
    publicMessage: function (e, t, a) {
      var o = this;
      e.api && wx.showModal({
        title: "提示",
        content: "确定".concat(a, "?"),
        success: function (t) {
          if (t.confirm) {
            var i = "";
            i += r.getNetAddresss(e.api), i += "&order_id=" + o.data.orderPayId, r._getNetWork({
              url: i,
              success: function (t) {
                var r = t.data;
                1 == r.result ? (o.triggerEvent("ConfrimOrderNotification", "pay"), "inventory_cancel" == e.value ? wx.showModal({
                  content: "申请成功,请到待发货列表查询此订单"
                }) : wx.showToast({
                  icon: "success",
                  title: "".concat(a, "成功"),
                  duration: 1e3
                })) : wx.showToast({
                  icon: "none",
                  title: r.msg,
                  duration: 1e3
                });
              },
              fail: function (e) {
                console.log(e);
              }
            });
          }
        }
      });
    },
    onClose: function () {
      this.setData({
        showQrcode: !1
      });
    },
    _checklogistics: function (e, t) {
      console.log(e, t), 0 == e.is_all_send_goods ? wx.navigateTo({
        url: "/packageA/member/order/logistics/logistics?id=" + e.id + "&api=" + t.api
      }) : wx.navigateTo({
        url: "/packageE/multiplePackages/multiplePackages?id=" + e.id + "&api=" + t.api
      });
    },
    getRuruen: function (e, t) {
      var a = this,
        o = r.getNetAddresss(e.api);
      o += "&order_id=" + t.id, r._getNetWork({
        url: o,
        success: function (e) {
          var t = e.data;
          1 == t.result ? (wx.showToast({
            title: t.msg,
            icon: "none",
            duration: 1500
          }), a.triggerEvent("ConfrimOrderNotification")) : wx.showToast({
            icon: "none",
            title: t.msg,
            duration: 1e3
          });
        },
        fail: function (e) {
          console.log(e);
        }
      });
    },
    _deleteOrder: function (e, t, a) {
      var r = this;
      wx.showModal({
        title: "提示",
        content: "确定删除此订单?",
        success: function (o) {
          if (o.confirm) {
            var i = r.data.datasource;
            i.splice(a, 1), r.setData({
              datasource: i
            }), r._sentRequest(t.api, "&order_id=" + e.id, !1);
          }
        }
      });
    },
    _sentRequest: function (e, t, a) {
      var o = r.getNetAddresss(e);
      o += t, r._getNetWork({
        url: o,
        success: function (e) {
          var t = e.data;
          1 == t.result ? wx.showToast({
            title: t.msg,
            icon: "none",
            duration: 1500,
            success: function () {
              setTimeout(function () {
                wx.navigateBack({
                  delta: 1
                });
              }, 1500);
            }
          }) : wx.showToast({
            icon: "none",
            title: t.msg,
            duration: 1e3
          });
        },
        fail: function (e) {
          console.log(e);
        }
      });
    },
    _comment: function (e, t) {
      wx.navigateTo({
        url: "/packageB/comment/comment?order=" + JSON.stringify(e || {})
      });
    },
    _toPay: function (e, t) {
      "107" != e.plugin_id ? wx.navigateTo({
        url: "/packageD/buy/orderPay/orderPay?order_id=" + e.id + "&status=1&api=" + t.api
      }) : wx.navigateTo({
        url: "/packageD/buy/orderPay/orderPay?order_id=" + e.id + "&status=1&api=" + t.api + "&name=bilndBox"
      });
    },
    _toRefundDetail: function (e, t) {
      var a;
      154 == e.plugin_id ? wx.navigateTo({
        url: "/packageD/member/myOrder/Aftersales/Aftersales?refund_id=".concat(null === (a = e.travel_around_refund) || void 0 === a ? void 0 : a.id, "&pluginid=").concat(e.plugin_id)
      }) : wx.navigateTo({
        url: "/packageD/member/myOrder/Aftersales/Aftersales?refund_id=" + e.refund_id
      });
    },
    _toRefund: function (e, t) {
      var a;
      "107" != e.plugin_id ? "154" != e.plugin_id ? "snatch_regiment_refund" == t.value ? wx.navigateTo({
        url: "/packageD/member/myOrder/refund/refund?order_id=" + e.id + "&type=3"
      }) : wx.navigateTo({
        url: "/packageD/member/myOrder/refund/refund?order_id=" + e.id + "&type=1"
      }) : wx.navigateTo({
        url: "/packageD/member/myOrder/refund/refund?order_id=".concat(null === (a = e.travel_around_order) || void 0 === a ? void 0 : a.order_id, "&type=4&value=").concat(t.value, "&pluginid=").concat(e.plugin_id)
      }) : wx.navigateTo({
        url: "/packageD/member/myOrder/refund/refund?order_id=" + e.id + "&type=1&value=" + t.value
      });
    },
    _cancleOrder: function (e, t, a) {
      var r = this;
      wx.showModal({
        title: "提示",
        content: "确定取消此订单?",
        success: function (o) {
          if (o.confirm) {
            var i = r.data.datasource;
            i.splice(a, 1), r.setData({
              datasource: i
            }), r._sentRequest(t.api, "&order_id=" + e.id, !1);
          }
        }
      });
    },
    _confirmOrder: function (e, t) {
      var a = this;
      console.log(e, this.data.custom_receipt_confirmation_html), 0 != e.plugin_id && 44 != e.plugin_id || "" === this.data.custom_receipt_confirmation_html ? wx.showModal({
        title: "提示",
        content: "您确定收到货物?",
        success: function (r) {

          // r.confirm && a._confirmOrder_request(e, t);
          if (r.confirm) {
            a._confirmOrder_request(e, t)
            // 微信确认收货--新增
            a.confirm_order_wechat(e, t)
          }

        }
      }) : this.setData({
        custom_receipt_confirmation_btn: t,
        custom_receipt_confirmation_item: e,
        custom_receipt_confirmation_show: !0
      });
    },
    CustomReceiptConfirmationSend: function () {
      this._confirmOrder_request(this.data.custom_receipt_confirmation_item, this.data.custom_receipt_confirmation_btn);
    },

    // 新增小程序确认收货组件
    confirm_order_wechat: function (e, t) {
      let uniacid = wx.getStorageSync('yz_basic_info').home.item.ViewSet.member.uniacid
      let id = e.id
      var a = this,
        o = r.getNetAddresss('YuZong.xiaochengxushouhuo');
      r._getNetWork({
        url: o,
        data: {
          order_id: id,
          uniacid: uniacid
        },
        success: function (e) {
          console.log(e, 'jahahahahah')
          var t = e.data;
          console.log(t,'iiiiiiiiiiiiiiiii')
          if (1 == t.result) {
            //拉起确认收货组件
            if (wx.openBusinessView) {
              console.log(';;;;;;;;;')
              wx.openBusinessView({
                businessType: 'weappOrderConfirm',
                extraData: {
                  merchant_id: t.data.weixin_mchid,
                  merchant_trade_no: t.data.pay_sn,
                  transaction_id: ''
                },
                success(e) {
                  console.log(e, '成功')
                  //dosomething
                },
                fail(e) {
                  console.log(e, '失败')
                  //dosomething
                },
                complete() {
                  //dosomething
                }
              });
            } else {
              //引导用户升级微信版本
            }
          } else {
            r.tips(t.msg)
          }
          //  ? (a.triggerEvent("ConfrimOrderNotification", "pay"), r.tips(t.msg)) : r.tips(t.msg);
        },
        fail: function (e) {
          console.log(e);
        }
      });
    },
    _confirmOrder_request: function (e, t) {
      var a = this,
        o = r.getNetAddresss(t.api);
      o += "&order_id=" + e.id, r._getNetWork({
        url: o,
        success: function (e) {
          var t = e.data;
          1 == t.result ? (a.triggerEvent("ConfrimOrderNotification", "pay"), r.tips(t.msg)) : r.tips(t.msg);
        },
        fail: function (e) {
          console.log(e);
        }
      });
    },
    _cashPayOrder: function (e, t) {
      var a = this;
      wx.showModal({
        title: "提示",
        content: "确定此订单已付款?",
        success: function (r) {
          r.confirm && a._sentRequest(t.api, "&order_id=" + e.id + "&order_pay_id=" + a.data.order_pay_id, !1);
        }
      });
    },
    _verification: function (e, t) {
      wx.navigateTo({
        url: "/packageD/member/myOrder/orderVerification/orderVerification?order_id=" + e.id + "&api=" + t.api
      });
    },
    _verificationCash: function (e, t) {
      var a = this;
      wx.showModal({
        title: "提示",
        content: "确定此订单已付款?",
        success: function (r) {
          r.confirm && a._sentRequest(t.api, "&order_id=" + e.id + "&order_pay_id=" + a.data.order_pay_id, !1);
        }
      });
    },
    _payMoney: function (e, t) {
      var a = this;
      wx.showModal({
        title: "提示",
        content: "确认支付该订单?",
        success: function (e) {
          if (e.confirm) {
            var o = "";
            "supplier" == a.data.orderType || "subsidiary" == a.data.orderType || "storeMang" == a.data.orderType ? (o += r.getNetAddresss(t.api),
              o += "&order_id=" + a.data.orderPayId) : (o += r.getNetAddresss("plugin.store-cashier.frontend.store.center.order-operation.pay"),
              o += "&order_id=" + a.data.orderPayId), r._getNetWork({
              url: o,
              success: function (e) {
                var t = e.data;
                1 == t.result ? (a.triggerEvent("ConfrimOrderNotification", "pay"), wx.showToast({
                  icon: "success",
                  title: "支付成功",
                  duration: 1e3
                })) : wx.showToast({
                  icon: "none",
                  title: t.msg,
                  duration: 1e3
                });
              },
              fail: function (e) {
                console.log(e);
              }
            });
          }
        }
      });
    },
    _getCompany: function () {
      var e = this,
        t = "";
      "supplier" == e.data.orderType ? t += r.getNetAddresss("plugin.supplier.frontend.order.express-company") : "subsidiary" == e.data.orderType ? t += r.getNetAddresss("plugin.subsidiary.frontend.order.express-company") : "storeMang" == e.data.orderType ? t += r.getNetAddresss("plugin.shop-assistant.frontend.order.expressCompanies") : t += r.getNetAddresss("plugin.store-cashier.frontend.store.center.sendOrder"),
        t += "&order_id=" + e.data.orderPayId, r._getNetWork({
          url: t,
          success: function (t) {
            var a = t.data;
            if (1 == a.result) {
              e.setData({
                options: a.data.express_companies
              });
              var o = e.data.options.map(function (e) {
                return e.name;
              });
              r._isTextEmpty(a.data.jurisdiction_set) || e.setData({
                jurisdiction_set: a.data.jurisdiction_set
              }), e.setData({
                columns: o,
                addresseeInfo: a.data.address
              }), e.data.regional && "请选择快递公司" !== e.data.regional && a.data.express_companies.forEach(function (t) {
                if (t.name == e.data.regional) {
                  var a = {
                    value: t.value,
                    name: t.name
                  };
                  e.setData({
                    expressName: a
                  });
                }
              });
            }
          },
          fail: function (e) {
            console.log(e);
          }
        });
    },
    _deliverGoodsCancel: function (e, t) {
      var a = this;
      wx.showModal({
        title: "提示",
        content: "确定取消发货?",
        success: function (e) {
          if (e.confirm) {
            var o = "";
            "supplier" == a.data.orderType || "subsidiary" == a.data.orderType || "storeMang" == a.data.orderType ? (o += r.getNetAddresss(t.api),
              o += "&order_id=" + a.data.orderPayId) : "auction" == a.data.orderType ? (o += r.getNetAddresss("plugin.auction.api.order-operation.cancel-send"),
              o += "&order_id=" + a.data.orderPayId) : (o += r.getNetAddresss("plugin.store-cashier.frontend.store.center.order-operation.cancel-send"),
              o += "&order_id=" + a.data.orderPayId), r._getNetWork({
              url: o,
              success: function (e) {
                var t = e.data;
                1 == t.result ? (a.triggerEvent("ConfrimOrderNotification", "pay"), wx.showToast({
                  icon: "success",
                  title: "取消发货成功",
                  duration: 1e3
                })) : wx.showToast({
                  icon: "none",
                  title: t.msg,
                  duration: 1e3
                });
              },
              fail: function (e) {
                console.log(e);
              }
            });
          }
        }
      });
    },
    _collectGoods: function (e, t) {
      var a = this;
      wx.showModal({
        title: "提示",
        content: "确认收货?",
        success: function (e) {
          if (e.confirm) {
            var o = "";
            "supplier" == a.data.orderType || "subsidiary" == a.data.orderType || "pickup_card" == a.data.orderType || "picking-card-one" == a.data.orderType || "storeMang" == a.data.orderType ? (o += r.getNetAddresss(t.api),
              o += "&order_id=" + a.data.orderPayId) : (o += r.getNetAddresss("plugin.store-cashier.frontend.store.center.order-operation.receive"),
              o += "&order_id=" + a.data.orderPayId), r._getNetWork({
              url: o,
              success: function (e) {
                var t = e.data;
                1 == t.result ? (a.triggerEvent("ConfrimOrderNotification", "pay"), wx.showToast({
                  icon: "success",
                  title: "收货成功",
                  duration: 1e3
                })) : wx.showToast({
                  icon: "none",
                  title: t.msg,
                  duration: 1e3
                });
              },
              fail: function (e) {
                console.log(e);
              }
            });
          }
        }
      });
    },
    _closeOrderPay: function (e, t) {
      var a = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "",
        o = this;
      wx.showModal({
        title: "提示",
        content: a || "确定关闭订单?",
        success: function (e) {
          if (e.confirm) {
            var a = "";
            "supplier" == o.data.orderType || "subsidiary" == o.data.orderType || "storeMang" == o.data.orderType ? (a += r.getNetAddresss(t.api),
              a += "&order_id=" + o.data.orderPayId) : (a += r.getNetAddresss("plugin.store-cashier.frontend.store.center.order-operation.close"),
              a += "&order_id=" + o.data.orderPayId, a += "&shop_id=null"), r._getNetWork({
              url: a,
              success: function (e) {
                var t = e.data;
                1 == t.result ? (o.triggerEvent("ConfrimOrderNotification", "pay"), wx.showToast({
                  icon: "success",
                  title: "关闭订单成功",
                  duration: 1e3
                })) : wx.showToast({
                  icon: "none",
                  title: t.msg,
                  duration: 1e3
                });
              },
              fail: function (e) {
                console.log(e);
              }
            });
          }
        }
      });
    },
    _evaluate: function (e, t) {
      wx.navigateTo({
        url: "/packageD/member/myOrder/DeliveryEvaluate/DeliveryEvaluate?order_id=" + e.order_id + "&api=" + t.api + "&name=distributor"
      });
    },
    _truckList: function (e, t) {
      wx.navigateTo({
        url: "/packageD/member/myOrder/truckList/truckList?order_id=" + t.id
      });
    },
    _checkInvoice: function (e, t) {
      wx.navigateTo({
        url: "/packageD/member/myOrder/invoice/invoice?order_id=" + t.id
      });
    },
    numberNamebtn: function (e) {
      var t = e.detail.value;
      this.setData({
        numberName: t
      });
    },
    sendGoogs: function (e) {
      var t = this;
      if (e && "confirm" !== e.detail) this.setData({
        dialogVisible: !1
      }), this.triggerEvent("stoprefresh", !1);
      else {
        var a = this,
          o = function (e) {
            t.setData({
              sendGoogsFail: {
                show: !0,
                msg: e
              },
              dialogVisible: !1
            });
          };
        if ("supplier" == this.data.orderType) {
          var i = "";
          i += r.getNetAddresss("plugin.supplier.frontend.order.send");
          var s = {
            order_id: a.data.orderPayId,
            express_code: a.data.expressName.value,
            express_company_name: a.data.expressName.name,
            express_sn: a.data.numberName
          };
          r._postNetWork({
            url: i,
            showToastIn: !1,
            data: s,
            success: function (e) {
              var t = e.data;
              console.log("msg=", t), 1 == t.result ? (a.setData({
                  dialogVisible: !1
                }), a.triggerEvent("stoprefresh", !1), a.triggerEvent("ConfrimOrderNotification", "pay"),
                wx.showToast({
                  icon: "success",
                  title: "发货成功",
                  duration: 1e3
                })) : o(t.msg);
            },
            fail: function (e) {}
          });
        } else if ("subsidiary" == this.data.orderType) {
          var n = "";
          n += r.getNetAddresss("plugin.subsidiary.frontend.order.send");
          var d = {
            order_id: a.data.orderPayId,
            express_code: a.data.expressName.value,
            express_company_name: a.data.expressName.name,
            express_sn: a.data.numberName
          };
          r._postNetWork({
            url: n,
            showToastIn: !1,
            data: d,
            success: function (e) {
              var t = e.data;
              1 == t.result ? (a.setData({
                  dialogVisible: !1
                }), a.triggerEvent("stoprefresh", !1), a.triggerEvent("ConfrimOrderNotification", "pay"),
                wx.showToast({
                  icon: "success",
                  title: "发货成功",
                  duration: 1e3
                })) : o(t.msg);
            },
            fail: function (e) {}
          });
        } else if ("auction" == this.data.orderType || "storeMang" == this.data.orderType) {
          var c = "";
          c = r.getNetAddresss("plugin.auction.api.order-operation.send"), "storeMang" == this.data.orderType && (c += r.getNetAddresss("plugin.shop-assistant.frontend.order.send"));
          var l = {
            order_id: a.data.orderPayId,
            express_code: a.data.expressName.value,
            express_company_name: a.data.expressName.name,
            express_sn: a.data.numberName
          };
          r._postNetWork({
            url: c,
            showToastIn: !1,
            data: l,
            success: function (e) {
              var t = e.data;
              1 == t.result ? (a.setData({
                  dialogVisible: !1
                }), a.triggerEvent("stoprefresh", !1), a.triggerEvent("ConfrimOrderNotification", "pay"),
                wx.showToast({
                  icon: "success",
                  title: "发货成功",
                  duration: 1e3
                })) : o(t.msg);
            },
            fail: function (e) {}
          });
        } else {
          var u = "";
          u += r.getNetAddresss("plugin.store-cashier.frontend.store.center.order-operation.send"),
            u += "&order_id=" + a.data.orderPayId, u += "&express_code=" + a.data.expressName.value,
            u += "&express_company_name=" + a.data.expressName.name, u += "&express_sn=" + a.data.numberName,
            r._getNetWork({
              url: u,
              success: function (e) {
                var t = e.data;
                1 == t.result ? (console.log("result=", t.result), a.triggerEvent("ConfrimOrderNotification", "pay"),
                  wx.showToast({
                    icon: "success",
                    title: "发货成功",
                    duration: 1e3
                  }), a.setData({
                    dialogVisible: !1
                  })) : o(t.msg);
              },
              fail: function (e) {}
            });
        }
      }
    },
    colseSendGoogsFailPopup: function () {
      this.setData({
        "sendGoogsFail.show": !1
      });
    },
    seleRegional: function () {
      this.setData({
        dateshow_1: !0
      });
    },
    onCancelbtn: function () {
      this.setData({
        dateshow_1: !1,
        inputExpressCompanyName: "",
        filterExpressCompanys: []
      });
    },
    onConfirmbtn: function (e) {
      var t = this,
        a = e.detail.index,
        r = e.detail.value,
        o = this.data.options.filter(function (e) {
          return -1 !== e.name.indexOf(t.data.inputExpressCompanyName);
        });
      this.setData({
        dateshow_1: !1,
        regional: r,
        expressName: o[a],
        inputExpressCompanyName: "",
        filterExpressCompanys: []
      });
    },
    noop: function () {},
    confirmHotelOrder: function (e, t) {
      var a = "";
      a += r.getNetAddresss(e), a += "&order_id=" + t, r._getNetWork({
        url: a,
        success: function (e) {
          var t = e.data;
          t.result, wx.showToast({
            icon: "none",
            title: t.msg,
            duration: 1e3
          });
        },
        fail: function (e) {
          console.log(e);
        }
      });
    },
    copyorderbtn: function (e) {
      var t = e.currentTarget.dataset.copydata;
      wx.setClipboardData({
        data: t || "",
        success: function (e) {
          wx.showToast({
            icon: "none",
            title: "复制成功",
            duration: 1e3
          });
        }
      });
    },
    onCloseRefundShow: function () {
      this.setData({
        refundShow: !1
      });
    },
    evaluateOpration: function (e) {
      var t = e.target.dataset.btn,
        a = e.target.dataset.goods,
        r = e.target.dataset.order.id;
      if (0 == t.value) wx.navigateTo({
        url: "/packageD/member/evaluate/evaluate?order_id=" + r + "&id=" + a.id
      });
      else if (1 == t.value) wx.navigateTo({
        url: "/packageD/member/addevaluate/addevaluate?order_id=" + r + "&item=" + JSON.stringify(a)
      });
      else if (2 == t.value) {
        var o = "?order_id=" + r;
        o = (o = (o = o + "&goods_id=" + a.has_one_comment.goods_id) + "&comment_id=" + a.has_one_comment.id) + "&order_goods_id=" + a.id,
          wx.navigateTo({
            url: "/packageD/member/CommentDetails/CommentDetails" + o
          });
      }
    },
    onChangeInventoryApplyRadio: function (e) {
      this.setData({
        inventoryApplyRadio: e.detail
      });
    },
    getWarehouseList_CH: function () {
      var e = this,
        t = r.getNetAddresss("plugin.order-inventory.frontend.index.warehouse-list");
      r._postNetWork({
        url: t,
        data: {},
        success: function (t) {
          var a = t.data;
          1 == a.result ? e.setData({
            inventoryApplyList: a.data.list,
            inventoryApplyRadio: a.data.list[0].id,
            inventoryApplyPopup: !0
          }) : r.tips(a.msg);
        },
        fail: function (e) {
          console.log(e);
        }
      });
    },
    confirmInventoryApply: function () {
      var e = this,
        t = r.getNetAddresss("plugin.order-inventory.frontend.index.inventory-apply");
      r._postNetWork({
        url: t,
        data: {
          warehouse_id: this.data.inventoryApplyRadio,
          order_id: this.data.orderPayId
        },
        success: function (t) {
          var a = t.data;
          r.tips(a.msg), 1 == a.result && e.triggerEvent("ConfrimOrderNotification", "pay");
        },
        fail: function (e) {
          console.log(e);
        }
      });
    },
    getKefu: function (e) {
      var t = this,
        a = "";
      e.length > 0 && (a = e[0].goods_id);
      var o = r.getNetAddresss("goods.customer-service.index");
      r._postNetWork({
        url: o,
        data: {
          goods_id: a
        },
        success: function (e) {
          var a = e.data;
          1 == a.result && t.setData({
            customer_open: 0 != a.data.customer_open,
            showKefu: !0,
            cservice: a.data.cservice,
            service_QRcode: a.data.service_QRcode,
            service_mobile: a.data.service_mobile
          });
        },
        fail: function (e) {
          console.log(e);
        }
      });
    },
    issueGoodsClose: function () {
      this.setData({
        overlayShow: !1
      });
    },
    drawGoodsClose: function () {
      this.setData({
        drawShow: !1
      });
    }
  }
});